package com.java.oop;

/**
 * 老师
 */
public class Teacher extends Person{

    private String course;

    public Teacher(){
        System.out.println("Teacher无参构造方法");
    }

    public Teacher(String name, int age, String gender, String address,String course){
        //调用父类构造方法
        super(name,age,gender,address);
        this.course = course;
        System.out.println("Teacher有参的构造方法");
    }

    /**
     * 重写父类方法
     */
    public void speak(){
        System.out.println("同学们好！！！同学们辛苦了！！！");
    }

    public String getCourse() {
        return course;
    }

    public void setCourse(String course) {
        this.course = course;
    }

    /**
     * 上课
     */
    public void teach(){
        System.out.println("别讲话了！" + this.getName() +"开始上" + this.getCourse());
    }

    public static void main(String[] args) {
        Teacher teacher = new Teacher("恒哥",18,"男","武汉","Java");
//        Teacher teacher = new Teacher();
//        teacher.setName("恒哥");
//        teacher.setCourse("面向对象");
        teacher.speak();
        teacher.teach();
    }
}
